```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Tomcat线程池配置与优化指南</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            color: #333;
            line-height: 1.6;
        }
        h1, h2, h3, h4 {
            font-family: 'Noto Serif SC', serif;
            font-weight: 600;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
        }
        .card-hover {
            transition: all 0.3s ease;
        }
        .card-hover:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
        }
        .param-card {
            border-left: 4px solid #4f46e5;
        }
        .code-block {
            background-color: #f8fafc;
            border-radius: 8px;
            border-left: 4px solid #4f46e5;
        }
        .highlight {
            position: relative;
        }
        .highlight::after {
            content: '';
            position: absolute;
            left: 0;
            bottom: 2px;
            width: 100%;
            height: 6px;
            background-color: rgba(79, 70, 229, 0.2);
            z-index: -1;
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20 px-4 md:px-0">
        <div class="container mx-auto max-w-4xl text-center">
            <div class="flex justify-center mb-6">
                <span class="bg-white bg-opacity-20 rounded-full px-4 py-1 text-sm font-semibold flex items-center">
                    <i class="fas fa-server mr-2"></i> 服务器性能优化
                </span>
            </div>
            <h1 class="text-4xl md:text-5xl font-bold mb-6">Tomcat线程池<span class="highlight">配置与优化</span>指南</h1>
            <p class="text-xl md:text-2xl text-white text-opacity-90 mb-8 max-w-3xl mx-auto">
                深入解析Tomcat线程池的关键参数配置，提升Web应用性能与稳定性
            </p>
            <div class="flex justify-center space-x-4">
                <a href="#config" class="bg-white text-indigo-600 px-6 py-3 rounded-lg font-medium hover:bg-gray-100 transition duration-300">
                    <i class="fas fa-cog mr-2"></i>配置详解
                </a>
                <a href="#optimize" class="border border-white border-opacity-30 text-white px-6 py-3 rounded-lg font-medium hover:bg-white hover:bg-opacity-10 transition duration-300">
                    <i class="fas fa-chart-line mr-2"></i>优化策略
                </a>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <div class="container mx-auto max-w-4xl px-4 py-16">
        <!-- Introduction -->
        <section class="mb-20">
            <p class="text-lg text-gray-700 mb-6">
                在Tomcat中，线程池的配置和优化是提高Web应用程序性能的重要手段之一。Tomcat的线程池主要用于处理HTTP请求，因此合理地配置线程池参数可以显著影响服务器的吞吐量和响应时间。
            </p>
            <div class="bg-blue-50 border-l-4 border-blue-500 p-4 rounded-r-lg mb-8">
                <div class="flex">
                    <div class="flex-shrink-0">
                        <i class="fas fa-info-circle text-blue-500 text-xl mt-1"></i>
                    </div>
                    <div class="ml-3">
                        <p class="text-blue-800">
                            <strong>专业建议：</strong> 在调整线程池参数前，建议先通过监控工具了解当前系统的负载情况，再进行有针对性的优化。
                        </p>
                    </div>
                </div>
            </div>
        </section>

        <!-- Configuration Section -->
        <section id="config" class="mb-20">
            <h2 class="text-3xl font-bold mb-6 flex items-center">
                <span class="w-8 h-8 bg-indigo-100 text-indigo-600 rounded-full flex items-center justify-center mr-4">1</span>
                Tomcat线程池配置详解
            </h2>
            
            <p class="text-gray-700 mb-8">
                Tomcat使用<strong>Executor</strong>组件来配置线程池。<code>Executor</code>是一个通用的线程池配置，可以在多个连接器之间共享。默认情况下，Tomcat使用连接器（如<code>HTTP Connector</code>和<code>AJP Connector</code>）的内部线程池来处理请求，但你也可以手动定义一个共享的线程池。
            </p>
            
            <div class="mb-10">
                <h3 class="text-2xl font-semibold mb-4 text-indigo-700">
                    <i class="fas fa-code mr-2"></i>示例配置
                </h3>
                <p class="text-gray-600 mb-4">下面是一个典型的Tomcat线程池配置示例，在<code>server.xml</code>文件中定义：</p>
                
                <div class="code-block p-5 mb-6 overflow-x-auto">
                    <pre class="text-sm text-gray-800"><code>&lt;Executor name="tomcatThreadPool" 
          namePrefix="catalina-exec-" 
          maxThreads="200" 
          minSpareThreads="25" /&gt;

&lt;Connector executor="tomcatThreadPool"
           port="8080" protocol="HTTP/1.1"
           connectionTimeout="20000"
           redirectPort="8443" /&gt;</code></pre>
                </div>
                
                <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                    <div class="bg-white p-6 rounded-lg shadow-md">
                        <h4 class="font-bold text-lg mb-3 text-indigo-700">Executor配置</h4>
                        <ul class="space-y-3">
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                <span><strong>name</strong>: 定义了一个名为<code>tomcatThreadPool</code>的线程池</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                <span><strong>namePrefix</strong>: 线程名称的前缀，方便在监控工具中识别</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                <span><strong>maxThreads</strong>: 线程池中允许的最大线程数</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                <span><strong>minSpareThreads</strong>: 保持在池中的最小空闲线程数</span>
                            </li>
                        </ul>
                    </div>
                    <div class="bg-white p-6 rounded-lg shadow-md">
                        <h4 class="font-bold text-lg mb-3 text-indigo-700">Connector配置</h4>
                        <ul class="space-y-3">
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                <span><strong>executor</strong>: 指定使用名为<code>tomcatThreadPool</code>的线程池</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                <span><strong>port</strong>: 服务监听端口</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                <span><strong>protocol</strong>: 使用的协议版本</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                <span><strong>connectionTimeout</strong>: 连接超时时间(毫秒)</span>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
            
            <!-- Parameters Section -->
            <div>
                <h3 class="text-2xl font-semibold mb-6 text-indigo-700">
                    <i class="fas fa-sliders-h mr-2"></i>线程池参数及其对性能的影响
                </h3>
                
                <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                    <!-- maxThreads -->
                    <div class="bg-white p-6 rounded-lg shadow-md param-card card-hover">
                        <div class="flex items-start mb-3">
                            <div class="bg-indigo-100 text-indigo-600 p-2 rounded-lg mr-4">
                                <i class="fas fa-bolt"></i>
                            </div>
                            <div>
                                <h4 class="font-bold text-lg">maxThreads</h4>
                                <p class="text-sm text-gray-500">线程池中最大线程数</p>
                            </div>
                        </div>
                        <div class="pl-14">
                            <p class="text-gray-700 mb-3">
                                <strong>影响：</strong>如果设置过低，可能导致高并发时的请求排队等待，增加响应时间；如果设置过高，可能导致过多线程竞争CPU和内存资源，降低整体性能。
                            </p>
                            <div class="bg-gray-50 p-3 rounded-lg">
                                <p class="text-sm text-gray-600 font-medium">
                                    <i class="fas fa-lightbulb text-yellow-500 mr-2"></i>
                                    <strong>优化建议：</strong>应根据服务器硬件配置（CPU核心数、内存大小）和应用的并发需求来设置。通常建议将<code>maxThreads</code>设置为2到4倍的CPU核心数。
                                </p>
                            </div>
                        </div>
                    </div>
                    
                    <!-- minSpareThreads -->
                    <div class="bg-white p-6 rounded-lg shadow-md param-card card-hover">
                        <div class="flex items-start mb-3">
                            <div class="bg-indigo-100 text-indigo-600 p-2 rounded-lg mr-4">
                                <i class="fas fa-shield-alt"></i>
                            </div>
                            <div>
                                <h4 class="font-bold text-lg">minSpareThreads</h4>
                                <p class="text-sm text-gray-500">池中保持的最小空闲线程数</p>
                            </div>
                        </div>
                        <div class="pl-14">
                            <p class="text-gray-700 mb-3">
                                <strong>影响：</strong>如果设置得太低，当流量激增时，可能会导致线程池创建新线程增加请求处理时间；设置得太高，则浪费资源。
                            </p>
                            <div class="bg-gray-50 p-3 rounded-lg">
                                <p class="text-sm text-gray-600 font-medium">
                                    <i class="fas fa-lightbulb text-yellow-500 mr-2"></i>
                                    <strong>优化建议：</strong>根据历史流量数据和峰值流量设置一个合理的值，确保线程池在大多数情况下都有足够的线程来处理请求。
                                </p>
                            </div>
                        </div>
                    </div>
                    
                    <!-- maxSpareThreads -->
                    <div class="bg-white p-6 rounded-lg shadow-md param-card card-hover">
                        <div class="flex items-start mb-3">
                            <div class="bg-indigo-100 text-indigo-600 p-2 rounded-lg mr-4">
                                <i class="fas fa-expand"></i>
                            </div>
                            <div>
                                <h4 class="font-bold text-lg">maxSpareThreads</h4>
                                <p class="text-sm text-gray-500">池中允许的最大空闲线程数</p>
                            </div>
                        </div>
                        <div class="pl-14">
                            <p class="text-gray-700 mb-3">
                                <strong>影响：</strong>超过这个数量的空闲线程会被销毁，释放资源。
                            </p>
                            <div class="bg-gray-50 p-3 rounded-lg">
                                <p class="text-sm text-gray-600 font-medium">
                                    <i class="fas fa-lightbulb text-yellow-500 mr-2"></i>
                                    <strong>优化建议：</strong>通常设置为<code>maxThreads</code>的1/2到3/4之间，以平衡资源占用和请求处理能力。
                                </p>
                            </div>
                        </div>
                    </div>
                    
                    <!-- acceptCount -->
                    <div class="bg-white p-6 rounded-lg shadow-md param-card card-hover">
                        <div class="flex items-start mb-3">
                            <div class="bg-indigo-100 text-indigo-600 p-2 rounded-lg mr-4">
                                <i class="fas fa-list-ol"></i>
                            </div>
                            <div>
                                <h4 class="font-bold text-lg">acceptCount</h4>
                                <p class="text-sm text-gray-500">当线程池中所有线程都在忙时，排队等待处理的请求数</p>
                            </div>
                        </div>
                        <div class="pl-14">
                            <p class="text-gray-700 mb-3">
                                <strong>影响：</strong>如果请求队列过长，用户体验会变差；如果队列太短，可能会导致过多的连接被拒绝。
                            </p>
                            <div class="bg-gray-50 p-3 rounded-lg">
                                <p class="text-sm text-gray-600 font-medium">
                                    <i class="fas fa-lightbulb text-yellow-500 mr-2"></i>
                                    <strong>优化建议：</strong>应根据<code>maxThreads</code>设置合理的<code>acceptCount</code>。通常，<code>acceptCount</code>是<code>maxThreads</code>的2到4倍。
                                </p>
                            </div>
                        </div>
                    </div>
                    
                    <!-- connectionTimeout -->
                    <div class="bg-white p-6 rounded-lg shadow-md param-card card-hover">
                        <div class="flex items-start mb-3">
                            <div class="bg-indigo-100 text-indigo-600 p-2 rounded-lg mr-4">
                                <i class="fas fa-clock"></i>
                            </div>
                            <div>
                                <h4 class="font-bold text-lg">connectionTimeout</h4>
                                <p class="text-sm text-gray-500">等待请求数据到达的最大时间（毫秒）</p>
                            </div>
                        </div>
                        <div class="pl-14">
                            <p class="text-gray-700 mb-3">
                                <strong>影响：</strong>过长的超时设置可能导致服务器资源占用过多；过短的超时设置可能会过早地关闭合法请求。
                            </p>
                            <div class="bg-gray-50 p-3 rounded-lg">
                                <p class="text-sm text-gray-600 font-medium">
                                    <i class="fas fa-lightbulb text-yellow-500 mr-2"></i>
                                    <strong>优化建议：</strong>根据网络环境和应用需求设置。一般情况下，20,000毫秒（20秒）是一个合理的默认值。
                                </p>
                            </div>
                        </div>
                    </div>
                    
                    <!-- keepAliveTimeout -->
                    <div class="bg-white p-6 rounded-lg shadow-md param-card card-hover">
                        <div class="flex items-start mb-3">
                            <div class="bg-indigo-100 text-indigo-600 p-2 rounded-lg mr-4">
                                <i class="fas fa-link"></i>
                            </div>
                            <div>
                                <h4 class="font-bold text-lg">keepAliveTimeout</h4>
                                <p class="text-sm text-gray-500">持久连接的超时时间（毫秒）</p>
                            </div>
                        </div>
                        <div class="pl-14">
                            <p class="text-gray-700 mb-3">
                                <strong>影响：</strong>适当的超时设置可以减少连接的频繁建立和关闭，提高性能；过短的超时可能会增加连接建立的开销。
                            </p>
                            <div class="bg-gray-50 p-3 rounded-lg">
                                <p class="text-sm text-gray-600 font-medium">
                                    <i class="fas fa-lightbulb text-yellow-500 mr-2"></i>
                                    <strong>优化建议：</strong>通常设置为5到10秒（5000到10000毫秒），以在节省资源和保持活跃连接之间取得平衡。
                                </p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>
        
        <!-- Optimization Section -->
        <section id="optimize" class="mb-20">
            <h2 class="text-3xl font-bold mb-8 flex items-center">
                <span class="w-8 h-8 bg-indigo-100 text-indigo-600 rounded-full flex items-center justify-center mr-4">2</span>
                Tomcat线程池优化策略
            </h2>
            
            <div class="grid grid-cols-1 gap-6">
                <!-- Strategy 1 -->
                <div class="bg-white rounded-lg shadow-md overflow-hidden">
                    <div class="md:flex">
                        <div class="p-6 flex-1">
                            <h3 class="text-xl font-bold mb-3 text-indigo-700">1. 合理分配线程资源</h3>
                            <p class="text-gray-700 mb-4">
                                根据服务器的硬件配置和应用的并发量需求，合理设置<code>maxThreads</code>和<code>minSpareThreads</code>参数，确保服务器在处理高并发时能够稳定运行。
                            </p>
                            <ul class="text-gray-600 space-y-2">
                                <li class="flex items-start">
                                    <i class="fas fa-check text-indigo-500 mr-2 mt-1"></i>
                                    <span>对于CPU密集型应用，线程数不宜设置过高</span>
                                </li>
                                <li class="flex items-start">
                                    <i class="fas fa-check text-indigo-500 mr-2 mt-1"></i>
                                    <span>对于IO密集型应用，可以适当增加线程数</span>
                                </li>
                                <li class="flex items-start">
                                    <i class="fas fa-check text-indigo-500 mr-2 mt-1"></i>
                                    <span>考虑服务器的物理内存限制，避免过多的线程导致内存溢出</span>
                                </li>
                            </ul>
                        </div>
                        <div class="hidden md:flex md:w-1/3 bg-indigo-50 items-center justify-center">
                            <div class="mermaid text-center p-4">
                                flowchart LR
                                    A[服务器硬件] --> B(CPU核心数)
                                    A --> C(内存大小)
                                    B --> D[maxThreads = 2-4×CPU核心]
                                    C --> E[考虑内存限制]
                            </div>
                        </div>
                    </div>
                </div>
                
                <!-- Strategy 2 -->
                <div class="bg-white rounded-lg shadow-md overflow-hidden">
                    <div class="md:flex flex-row-reverse">
                        <div class="p-6 flex-1">
                            <h3 class="text-xl font-bold mb-3 text-indigo-700">2. 调整请求队列长度</h3>
                            <p class="text-gray-700 mb-4">
                                使用<code>acceptCount</code>参数控制当所有线程都在忙时请求的排队数量，以避免服务器过载。
                            </p>
                            <ul class="text-gray-600 space-y-2">
                                <li class="flex items-start">
                                    <i class="fas fa-check text-indigo-500 mr-2 mt-1"></i>
                                    <span>队列长度应与<code>maxThreads</code>成比例</span>
                                </li>
                                <li class="flex items-start">
                                    <i class="fas fa-check text-indigo-500 mr-2 mt-1"></i>
                                    <span>过长的队列会导致请求响应时间增加</span>
                                </li>
                                <li class="flex items-start">
                                    <i class="fas fa-check text-indigo-500 mr-2 mt-1"></i>
                                    <span>使用监控工具观察队列使用情况</span>
                                </li>
                            </ul>
                        </div>
                        <div class="hidden md:flex md:w-1/3 bg-indigo-50 items-center justify-center">
                            <div class="mermaid text-center p-4">
                                pie
                                    title 队列长度设置比例
                                    "maxThreads" : 1
                                    "acceptCount" : 2-4
                            </div>
                        </div>
                    </div>
                </div>
                
                <!-- Strategy 3 -->
                <div class="bg-white rounded-lg shadow-md overflow-hidden">
                    <div class="md:flex">
                        <div class="p-6 flex-1">
                            <h3 class="text-xl font-bold mb-3 text-indigo-700">3. 优化连接超时设置</h3>
                            <p class="text-gray-700 mb-4">
                                使用<code>connectionTimeout</code>和<code>keepAliveTimeout</code>来控制连接的生命周期和等待时间，减少资源占用，提高请求处理效率。
                            </p>
                            <ul class="text-gray-600 space-y-2">
                                <li class="flex items-start">
                                    <i class="fas fa-check text-indigo-500 mr-2 mt-1"></i>
                                    <span>对于内部网络环境，可以适当减少超时时间</span>
                                </li>
                                <li class="flex items-start">
                                    <i class="fas fa-check text-indigo-500 mr-2 mt-1"></i>
                                    <span>对于移动端应用或高延迟网络，需要增加超时时间</span>
                                </li>
                                <li class="flex items-start">
                                    <i class="fas fa-check text-indigo-500 mr-2 mt-1"></i>
                                    <span>根据应用的平均响应时间设置合理的超时值</span>
                                </li>
                            </ul>
                        </div>
                        <div class="hidden md:flex md:w-1/3 bg-indigo-50 items-center justify-center">
                            <div class="mermaid text-center p-4">
                                graph TD
                                    A[网络环境] --> B[内部网络]
                                    A --> C[外部网络]
                                    B --> D[短超时]
                                    C --> E[长超时]
                            </div>
                        </div>
                    </div>
                </div>
                
                <!-- Strategy 4 -->
                <div class="bg-white rounded-lg shadow-md overflow-hidden">
                    <div class="md:flex flex-row-reverse">
                        <div class="p-6 flex-1">
                            <h3 class="text-xl font-bold mb-3 text-indigo-700">4. 使用适当的连接器协议</h3>
                            <p class="text-gray-700 mb-4">
                                根据应用场景选择合适的连接器协议（BIO、NIO、NIO2或APR），结合服务器硬件特性和操作系统类型，最大化服务器性能。
                            </p>
                            <div class="grid grid-cols-2 gap-4 mt-5">
                                <div class="bg-gray-50 p-3 rounded-lg">
                                    <h4 class="font-bold text-sm text-indigo-600 mb-1">BIO</h4>
                                    <p class="text-xs text-gray-600">阻塞式IO，适合简单应用</p>
                                </div>
                                <div class="bg-gray-50 p-3 rounded-lg">
                                    <h4 class="font-bold text-sm text-indigo-600 mb-1">NIO</h4>
                                    <p class="text-xs text-gray-600">非阻塞IO，高并发场景</p>
                                </div>
                                <div class="bg-gray-50 p-3 rounded-lg">
                                    <h4 class="font-bold text-sm text-indigo-600 mb-1">NIO2</h4>
                                    <p class="text-xs text-gray-600">异步IO，Java 7+</p>
                                </div>
                                <div class="bg-gray-50 p-3 rounded-lg">
                                    <h4 class="font-bold text-sm text-indigo-600 mb-1">APR</h4>
                                    <p class="text-xs text-gray-600">本地库，最高性能</p>
                                </div>
                            </div>
                        </div>
                        <div class="hidden md:flex md:w-1/3 bg-indigo-50 items-center justify-center">
                            <div class="mermaid text-center p-4">
                                graph LR
                                    A[协议选择] --> B[简单应用: BIO]
                                    A --> C[高并发: NIO/NIO2]
                                    A --> D[追求性能: APR]
                            </div>
                        </div>
                    </div>
                </div>
                
                <!-- Strategy 5 -->
                <div class="bg-white rounded-lg shadow-md overflow-hidden">
                    <div class="md:flex">
                        <div class="p-6 flex-1">
                            <h3 class="text-xl font-bold mb-3 text-indigo-700">5. 监控和调整</h3>
                            <p class="text-gray-700 mb-4">
                                使用监控工具（如JMX、VisualVM或Prometheus等）监控线程池的使用情况、请求响应时间和吞吐量等指标，根据实际负载情况动态调整参数。
                            </p>
                            <div class="grid grid-cols-1 md:grid-cols-3 gap-4 mt-5">
                                <div class="bg-gray-50 p-3 rounded-lg">
                                    <div class="flex items-center mb-1">
                                        <i class="fas fa-chart-bar text-indigo-500 mr-2"></i>
                                        <h4 class="font-bold text-sm text-indigo-600">关键指标</h4>
                                    </div>
                                    <ul class="text-xs text-gray-600 space-y-1">
                                        <li>活动线程数</li>
                                        <li>队列长度</li>
                                        <li>响应时间</li>
                                    </ul>
                                </div>
                                <div class="bg-gray-50 p-3 rounded-lg">
                                    <div class="flex items-center mb-1">
                                        <i class="fas fa-tools text-indigo-500 mr-2"></i>
                                        <h4 class="font-bold text-sm text-indigo-600">监控工具</h4>
                                    </div>
                                    <ul class="text-xs text-gray-600 space-y-1">
                                        <li>JMX</li>
                                        <li>VisualVM</li>
                                        <li>Prometheus</li>
                                    </ul>
                                </div>
                                <div class="bg-gray-50 p-3 rounded-lg">
                                    <div class="flex items-center mb-1">
                                        <i class="fas fa-clock text-indigo-500 mr-2"></i>
                                        <h4 class="font-bold text-sm text-indigo-600">调整时机</h4>
                                    </div>
                                    <ul class="text-xs text-gray-600 space-y-1">
                                        <li>流量变化</li>
                                        <li>性能下降</li>
                                        <li>应用升级</li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                        <div class="hidden md:flex md:w-1/3 bg-indigo-50 items-center justify-center">
                            <div class="mermaid text-center p-4">
                                flowchart TD
                                    A[监控] --> B[分析]
                                    B --> C[调整]
                                    C --> D[验证]
                                    D -->|循环| A
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>
        
        <!-- Summary Section -->
        <section class="bg-indigo-50 rounded-xl p-8 mb-20">
            <h2 class="text-2xl font-bold mb-6 text-indigo-700 text-center">
                <i class="fas fa-star mr-2"></i>Tomcat线程池优化要点总结
            </h2>
            <div class="grid grid-cols-1 md:grid-cols-3 gap-6">
                <div class="bg-white p-5 rounded-lg shadow-sm">
                    <h3 class="font-bold text-lg mb-3 text-indigo-600">
                        <i class="fas fa-microchip mr-2"></i>硬件适配
                    </h3>
                    <ul class="text-gray-700 space-y-2">
                        <li class="flex items-start">
                            <i class="fas fa-check text-green-500 mr-2 mt-1"></i>
                            <span>根据CPU核心数设置<code>maxThreads</code></span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check text-green-500 mr-2 mt-1"></i>
                            <span>考虑内存限制避免OOM</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check text-green-500 mr-2 mt-1"></i>
                            <span>IO密集型可增加线程数</span>
                        </li>
                    </ul>
                </div>
                <div class="bg-white p-5 rounded-lg shadow-sm">
                    <h3 class="font-bold text-lg mb-3 text-indigo-600">
                        <i class="fas fa-sliders-h mr-2"></i>参数调优
                    </h3>
                    <ul class="text-gray-700 space-y-2">
                        <li class="flex items-start">
                            <i class="fas fa-check text-green-500 mr-2 mt-1"></i>
                            <span><code>maxThreads</code>与<code>acceptCount</code>比例适当</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check text-green-500 mr-2 mt-1"></i>
                            <span>设置合理的超时时间</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check text-green-500 mr-2 mt-1"></i>
                            <span>空闲线程数动态调整</span>
                        </li>
                    </ul>
                </div>
                <div class="bg-white p-5 rounded-lg shadow-sm">
                    <h3 class="font-bold text-lg mb-3 text-indigo-600">
                        <i class="fas fa-chart-line mr-2"></i>持续优化
                    </h3>
                    <ul class="text-gray-700 space-y-2">
                        <li class="flex items-start">
                            <i class="fas fa-check text-green-500 mr-2 mt-1"></i>
                            <span>使用监控工具观察性能指标</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check text-green-500 mr-2 mt-1"></i>
                            <span>根据流量变化调整参数</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check text-green-500 mr-2 mt-1"></i>
                            <span>定期评估协议选择</span>
                        </li>
                    </ul>
                </div>
            </div>
        </section>
    </div>

    <!-- Footer -->
    <footer class="bg-gray-900 text-gray-300 py-10">
        <div class="container mx-auto px-4 text-center">
            <div class="mb-4">
                <h3 class="text-xl font-bold text-white mb-2">技术小馆</h3>
                <a href="http://www.yuque.com/jtostring" class="text-blue-400 hover:text-blue-300 transition duration-300">
                    http://www.yuque.com/jtostring
                </a>
            </div>
            <div class="text-sm text-gray-500">
                © 2023 技术小馆. 保留所有权利.
            </div>
        </div>
    </footer>

    <script>
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            fontFamily: '"Noto Sans SC", sans-serif',
            flowchart: {
                useMaxWidth: true,
                htmlLabels: true,
                curve: 'basis'
            },
            pie: {
                useMaxWidth: true,
                showText: true
            }
        });
        
        // 平滑滚动
        document.querySelectorAll('a[href^="#"]').forEach(anchor => {
            anchor.addEventListener('click', function (e) {
                e.preventDefault();
                document.querySelector(this.getAttribute('href')).scrollIntoView({
                    behavior: 'smooth'
                });
            });
        });
    </script>
</body>
</html>
```